/**
 * Created by bin.zhang on 14-11-7.
 */

define(['jquery','underscore','backbone','global','text!/android_asset/busAppWeb/module/busApp/cityContent/cityContent.html'],
    function($,_,Backbone,global,html){
        var cityContentView =  Backbone.View.extend({
            el:$('#busMain'),
            template: _.template(html),
            initialize:function(data){
                this.render();
                this.addListener();
            },
            render:function(){
                $(this.el).html(this.template);
                $('#busMain').trigger('create');
            },
            addListener:function(){
                $(document).ready(function(){
                    $('#cityUlId li').click(function(){
                        global.city = $(this)[0].innerText;
                        if(global.city != '城市'){
                            global.map.centerAndZoom(global.city,12);
                        }
                        Backbone.history.navigate('',true);
                    });
                });
            }
        });
        return cityContentView;
    })